Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: expose "run steps after a timeout" #7349

Merged
merged 3 commits into from
Nov 24, 2021
Merged

Conversation

domenic
Copy link
Member

@domenic domenic commented Nov 19, 2021

This factors out a new algorithm which can be used by postTask() (https://wicg.github.io/scheduling-apis/#schedule-a-posttask-task) and AbortSignal.timeout() (whatwg/dom#1032), ensuring that they correctly contribute to idle deadline computation and in general share all the appropriate logic with setTimeout() and setInterval().

This also exports the "timer task source" term since AbortSignal.abort() will want to use that.


/timers-and-user-prompts.html ( diff )
/webappapis.html ( diff )

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
This factors out a new algorithm which can be used by postTask() (https://wicg.github.io/scheduling-apis/#schedule-a-posttask-task) and AbortSignal.timeout() (whatwg/dom#1032), ensuring that they correctly contribute to idle deadline computation and in general share all the appropriate logic with setTimeout() and setInterval().

This also exports the "timer task source" term since AbortSignal.abort() will want to use that.
@domenic domenic changed the title Editorial: expose "wait for timeout" Editorial: expose "run steps after a timeout" Nov 23, 2021
@domenic domenic requested a review from annevk November 23, 2021 17:13
than zero that will identify the timeout to be set by this call in <var>global</var>'s <span>map
of active timers</span>.</p></li>
than zero and does not already <span data-x="map exists">exist</span> in <var>global</var>'s
<span>map of active timers</span>.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies that a now-cleared ID can be reused, even if less than 2^31 timers have been created so far. But this is probably best left for #7358.


<p>Otherwise, <var>global</var> is a <code>WorkerGlobalScope</code> object; wait until
<var>milliseconds</var> milliseconds have passed with the worker not suspended (not
necessarily consecutively).</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this xref "active needed worker"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interaction with the closing flag in https://html.spec.whatwg.org/#worker-processing-model:suspendable-worker makes me not 100% sure they are equivalent, so I'll leave it for now...

@domenic domenic merged commit 19aad58 into main Nov 24, 2021
@domenic domenic deleted the settimeout-refactoring branch November 24, 2021 16:14
andreubotella pushed a commit to andreubotella/requestidlecallback that referenced this pull request Dec 2, 2021
In whatwg/html#7349, the HTML spec factored out part of the
infrastructure for `setTimeout()` into a "run steps after a timeout"
algorithm for use by other specs. This change updates
`requestIdleCallback()` to use that algorithm when the `timeout`
property is present and positive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants